<template lang="">
  <div class="_wrapper _over-hidden">
    <ComImg v-if="aiUrl" :value="aiUrl" fit="contain" />
  </div>
</template>
<script>
import ComImg from "@/components/com-img/com-img.vue";
import ToolAction from "@/tool/http/tool-action";
export default {
  components: {
    ComImg,
  },
  data() {
    return {
      model: "Person",
      cameraIndexCode: "",
      aiUrl: "",
    };
  },
  mounted() {
    this.cameraIndexCode = this.$route.query.cameraIndexCode;
    this.model = this.$route.query.model;
    this.play();
  },
  methods: {
    play() {
      ToolAction.run(
        "action-video-get-url",
        "40289f5a7e3c994d017e3c998daf0000",
        {
          cameraIndexCode: this.cameraIndexCode,
          streamUrlProtocol: "PROTOCOL_RTSP",
        }
      ).then((res) => {
        this.aiUrl = undefined;
        this.$nextTick(() => {
          this.aiUrl = `https://lj.zzfmhb.com:18081/api_10002/vision?model=${
            this.model
          }&source=${JSON.parse(res).data.url}`;
        });
      });
    },
  },
};
</script>
<style scoped></style>
